package com.edais.service.imp;

import com.edais.dao.BankDao;
import com.edais.domain.Bank;
import com.edais.service.BankService;
import com.edais.util.Consts;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service

public class BankServiceImpl implements BankService {

	private static final Log logger = LogFactory
			.getLog(BankServiceImpl.class);
	
	@Autowired
	private BankDao bankDao;
	
	@Override
	public List<Bank> queryAllBankInfo(Map<String, Object> paramsMap) {
		return bankDao.queryAllBankInfo(paramsMap);
	}

	@Override
	public Map<String, Object> queryBankList(Map<String, String> paramsMap) throws Exception{
		
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		Map<String, String> map = new HashMap<String, String>();

		String bankFlg = paramsMap.get("bankFlg");
		map.put("bankFlg", bankFlg == null ? "KJ" : bankFlg);

		// 查询银行列表
		List<Map<String, String>> bankList = this.bankDao.queryBankList(map);

		rtnMap.put("rescode", Consts.SUCCESS_CODE);
		rtnMap.put("resmsg_cn", "查询成功");
		rtnMap.put("listSize", bankList.size());
		rtnMap.put("bankList", bankList);

		return rtnMap;
	}

	public Map<String, Object> queryRouteBankList(Map<String, String> params){
		Map<String, Object> rtnMap = new HashMap<String, Object>();

		Map<String, Object> map = new HashMap<String, Object>();
		String bankFlg = params.get("bankFlg");
		map.put("bankFlg", bankFlg == null ? "KJ" : bankFlg);

		// 查询银行列表
		List<Map<String, String>> bankList = this.bankDao.queryRouteBankList(map);

		rtnMap.put("rescode", Consts.SUCCESS_CODE);
		rtnMap.put("resmsg_cn", "查询成功");
		rtnMap.put("listSize", bankList.size());
		rtnMap.put("bankList", bankList);

		return rtnMap;
	}

	@Override
	public Map<String, Object> queryMyBank(Map<String, String> params) {
		return null;
	}
}
